﻿$(document).ready(function () {
    function resizeIframe() {
        var totalHeight = $(window).height();
        var lastFrame = $("[data-iframe-container]").last();
        var fromBot = $("[data-lastvisual]").position().top - lastFrame.position().top - lastFrame.height();
        lastFrame.height(totalHeight - fromBot - lastFrame.position().top);
        var iframe = lastFrame.children("iframe");
        iframe.height(iframe.contents().height());
        console.log("Resizing... Win: " + totalHeight + " from bot: " + fromBot);
    }
    $(window).resize(function () { resizeIframe(); });
    $("body").css("overflow", "hidden");
    resizeIframe();
})